﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for NhaDatMenuManager
/// </summary>
public class CanMuaMenuManager
{
    CanMuaMenuDAO canMuaMenuDao = new CanMuaMenuDAO();
    public CanMuaMenuManager()
    {

    }

    public List<CanMua> getAllCanMuaMenu()
    {
        List<CanMua> result = new List<CanMua>();

        DataTable dt = canMuaMenuDao.GetDataCanMua();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            CanMua nd = new CanMua();
            nd.Ten = Convert.ToString(dt.Rows[i]["Ten"]);
            nd.ID = Convert.ToString(dt.Rows[i]["ID"]);
            result.Add(nd);
        }
        return result;
    }

    public DataTable getAllCanMuaMenuReturnDT()
    {
        DataTable dt = canMuaMenuDao.GetDataCanMua();

        if (dt != null)
            return dt;

        return new DataTable();
    }

    public bool UpdateCanMuaMenu(CanMua canMua)
    {
        return canMuaMenuDao.UpdateCanMuaMenu(canMua);
    }

    public bool DeleteCanMuaMenu(CanMua canMua)
    {
        return canMuaMenuDao.DeleteCanMuaMenu(canMua);
    }

    public bool InsertCanMuaMenu(CanMua canMua)
    {
        return canMuaMenuDao.InsertCanMuaMenu(canMua);
    }
}